import { searchSpan, culomnSpan } from "@/api/span";
import fa from "element-ui/src/locale/lang/fa";

export const optionParent = {
  calcHeight: 95,
  tip: false,
  //searchShow: false,
  searchMenuSpan: searchSpan(3),
  border: true,
  searchLabelWidth: 120,
  labelWidth: 110,
  index: true,
  menuWidth: 150,
  dialogWidth: 880,
  dialogClickModal: false,
  selection: true,
  addBtn: false,
  delBtn: false,
  editBtn: false,
  viewBtn: false,
  highlightCurrentRow: true, 
  column: [
    {
      label: "质检规则编码",
      prop: "code",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
    },
    {
      label: "质检规则名称",
      prop: "name",
      search: true,
      searchSpan: culomnSpan(),
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false
    },
    {
      label: "业务类型",
      prop: "businessType",
      type: "select",
      dicUrl: "/api/hg-public/procedure/list",
      props: {
        label: "name",
        value: "id"
      },
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false
    },
    {
      label: "抽样计划",
      prop: "samplePlan",
      type: "select",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false
    },
    {
      label: "质检类型",
      prop: "category",
      type: "select",
      search: true,
      searchSpan: culomnSpan(),
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      dicUrl:
        "/api/blade-system/dict-biz/dictionary?code=quality_rule_category",
      props: {
        label: "dictValue",
        value: "dictKey"
      }
    },
    {
      label: "修改时间",
      prop: "updateTime",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false
    },
    {
      label: "备注",
      prop: "remark",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false
    }
  ],
  group: [
    {
      label: "质检规则信息",
      column: [
        {
          label: "质检规则编码",
          prop: "code",
          maxlength: 50,
          showWordLimit: true,
          formslot:true,
          rules: [
            {
              required: true,
              message: "请输入质检规则编码",
              trigger: "blur"
            }
          ]
        },
        {
          label: "质检规则名称",
          prop: "name",
          maxlength: 20,
          showWordLimit: true,
          formslot:true,
          rules: [
            {
              required: true,
              message: "请输入质检规则名称",
              trigger: "blur"
            }
          ]
        },
        {
          label: "业务类型",
          prop: "businessType",
          formslot:true,
          type: "select",
          dicUrl: "/api/hg-public/procedure/list",
          props: {
            label: "name",
            value: "id"
          },
          rules: [
            {
              required: true,
              message: "请选择业务类型",
              trigger: "blur"
            }
          ]
        },

        {
          label: "质检类型",
          prop: "category",
          type: "select",
          formslot:true,
          dicUrl:
            "/api/blade-system/dict-biz/dictionary?code=quality_rule_category",
          props: {
            label: "dictValue",
            value: "dictKey"
          },
          rules: [
            {
              required: true,
              message: "请选择质检类型",
              trigger: "blur"
            }
          ]
        },
        {
          label: "抽样计划",
          prop: "samplePlan",
          type: "textarea",
          maxlength: 50,
          minRows: 3,
          showWordLimit: true,
          span: 24
        },
        {
          label: "修改时间",
          prop: "updateTime",
          addDisplay: false,
          editDisplay: false
        },
        {
          label: "备注",
          prop: "remark",
          type: "textarea",
          maxlength: 60,
          minRows: 3,
          showWordLimit: true,
          span: 24
        },
        {
          title: "",
          component: "el-divider",
          span: 24,
          labelWidth: "0px",
          params: {
            contentPosition: "left"
          }
        },
        {
          label: "物料名称/编码",
          prop: "materialCodeOrName",
          addDisplay: false,
          editDisplay: false,
          viewDisplay: false,
          search: true,
          searchSpan: culomnSpan(),
        },
      ]
    }
  ]
};

export const optionChild = {
  calcHeight: 95,
  tip: false,
  searchShow: true,
  tree: true,
  border: true,
  index: true,
  menuWidth: 120,
  dialogWidth: 880,
  dialogClickModal: false,
  // menu: false,
  addBtn: false,
  delBtn: false,
  editBtn: false,
  viewBtn: false,
  column: [
    {
      label: "特性编码",
      prop: "itemCode",
      rules: [
        { required: true, message: "请填写特性编码", trigger: 'blur' }
      ],
      maxlength: 20
    },
    {
      label: "特性名称",
      prop: "itemName",
      rules: [
        { required: true, message: "请填写特性名称", trigger: 'blur' }
      ],
      maxlength: 20
    },
    {
      label: "特性要求",
      prop: "itemRequire",
      showColumn: false,
      maxlength: 20
    },
    {
      label: "特性等级",
      prop: "itemType",
      type: "select",
      dicUrl: "/api/hg-public/classify/list",
      props: {
        label: "quaType",
        value: "id"
      }
    },
    {
      label: "规范/公差",
      prop: "standard",
      span: 24,
      slot: true,
      formslot: true,
      maxlength: 150
    },
    {
      label: "检测类型",
      prop: "testType",
      maxlength: 20
    },
    {
      label: "检验手段",
      prop: "testMeans",
      rules: [
        { required: true, message: "请填写检验手段", trigger: 'blur' }
      ],
      maxlength: 20
    },
    {
      label: "检测方法",
      prop: "testMethod",
      type: "select",
      dicUrl: "/api/blade-system/dict-biz/dictionary?code=testMethod",
      props: {
        label: "dictValue",
        value: "dictKey"
      },
      rules: [
        { required: true, message: "请选择检测方法", trigger: 'blur' }
      ],
    },
    {
      label: "最小值",
      prop: "minValue",
      rules: [
        { required: true, message: "请填写最小值", trigger: 'blur' }
      ],
      formslot: true,
    },
    {
      label: "最大值",
      prop: "maxValue",
      rules: [
        { required: true, message: "请填写最大值", trigger: 'blur' }
      ],
      formslot: true,
    },
    {
      label: "默认值",
      prop: "defaultValue",
      display:false,
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      showColumn:false,
      hide:true
      // rules: [
      //   { required: true, message: "请填写默认值", trigger: 'blur' }
      // ],
      // //slot: true
      // formslot: true,
      // // labelslot: true
    },
    {
      label: "计量单位",
      prop: "unitCode",
      formslot: true,
      showColumn:false,
      hide:true
    },
    {
      label: "计量单位",
      prop: "unitName",
      display:false,
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
    },
    {
      label: "量具名称",
      prop: "measuringName",
      maxlength: 150,
      // readonly:true,
      // placeholder:false
      type: "select",
      formslot: true,
    },
    {
      label: "量具编码",
      prop: "measuringCode",
      // type: "select",
      // formslot: true,
       readonly:true,
       placeholder:false
    },
    {
      label: "抽样规则",
      prop: "samplingRule",
      span: 24,
      maxlength: 50
    },
    {
      label: "备注",
      prop: "remark",
      span: 24,
      maxlength: 150
    },

    {
      label: "数据来源",
      prop: "sourceFrom",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false
    }
  ]
};

export const optionChildMaterial = {
  calcHeight: 95,
  tip: false,
  searchShow: true,
  tree: true,
  border: true,
  index: true,
  menuWidth: 220,
  dialogWidth: 880,
  dialogClickModal: false,
  addBtn: false,
  editBtn: false,
  viewBtn: false,
  delBtn: false,
  column: [
    {
      label: "物料编码",
      prop: "materialNo"
    },
    {
      label: "物料名称",
      prop: "materialName"
    },
    {
      label: "零件图号",
      prop: "innerDrawingNo"
    },
    {
      label: "规格",
      prop: "specifications"
    },
    {
      label: "型号",
      prop: "model"
    },
    {
      label: "物料类型",
      prop: "materialTypeName"
    },
    {
      label: "追溯精度",
      prop: "traceAccuracy",
      display: false,
      type: "select",
      dicData: [
        {
          label: "批量",
          value: "1"
        },
        {
          label: "单件",
          value: "2"
        }
      ]
    },
    {
      label: "计量单位",
      prop: "unitName"
    }
  ]
};
